﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class FamousList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string cataID = Request.QueryString["cata"];
        string cata = "国画";
        if (cataID == "2") cata = "书法";
        else if (cataID == "3") cata = "篆刻";
        litCataName.Text = cata + "家";
        litProfessor1.Text = getProfessorList(cata).ToString();
    }

    private static System.Text.StringBuilder getProfessorList(string cata)
    {
        BZZ.DataAcess woker = new BZZ.DataAcess();
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        string sql = "select  * from professor where cata='" + cata + "' and isAgent='1' order by id desc";
        //string sql = "select * from professor where  isAgent='1' order by id desc";
        DataSet dset = woker.Execute(sql);

        #region 相关数据显示
        for (int i = 0; i < dset.Tables[0].Rows.Count; i++)
        {
            DataRow r = dset.Tables[0].Rows[i];
            string varid = r["id"].ToString().Trim();
            string varrealname = r["realname"].ToString().Trim();
            string varcata = r["cata"].ToString().Trim();
            string varisAgent = r["isAgent"].ToString().Trim();
            string varheadChar = r["headChar"].ToString().Trim();
            string varpudDate = r["pudDate"].ToString().Trim();
            string varisRecommend = r["isRecommend"].ToString().Trim();
            string varsortid = r["sortid"].ToString().Trim();
            string varpicurl = r["picurl"].ToString().Trim();
            string varabout = r["about"].ToString().Trim();
            varpicurl = "img/" + varpicurl;

            #region html拼接
            sb.Append("              <tr>");
            sb.Append("                <td width=\"140\" align=\"center\"><table width=\"130\" border=\"0\" align=\"center\" cellpadding=\"5\" cellspacing=\"1\" bgcolor=\"#cfcfb8\">");
            sb.Append("                  <tr>");
            sb.Append("                    <td align=\"center\" bgcolor=\"#FFFFFF\"><a href=\"professorDetail.aspx?id=" + varid + "\"><img src=\"" + varpicurl + "\" width=\"128\"  border=0></a></td>");
            sb.Append("                  </tr>");
            sb.Append("                </table></td>");
            sb.Append("                <td width=\"15\" align=\"center\"><p class=\"zt01\"><BR>");
            sb.Append("                  </p>");
            sb.Append("                  <p><BR>");
            sb.Append("                    </p></td>");
            sb.Append("                <td width=\"545\" align=\"center\" valign=\"top\"><table width=\"545\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
            sb.Append("                  <tr>");
            sb.Append("                    <td align=\"left\" bgcolor=\"#cfcfb8\" class=\"zt06\">　　<span class=\"zt\">姓名： " + varrealname + " </span></td>");
            sb.Append("                  </tr>");
            sb.Append("                  <tr>");
            sb.Append("                    <td height=\"10\" align=\"left\" class=\"zt01\">					</td>");
            sb.Append("                  </tr>");
            sb.Append("                  <tr>");
            sb.Append("                    <td align=\"left\" class=\"zt01\"><p>" + varabout + "</p>");
            sb.Append("                      <p>【<a href=\"professorDetail.aspx?id=" + varid + "\">查看更多" + varrealname + "作品</a>】</p></td>");
            sb.Append("                  </tr>");
            sb.Append("                </table></td>");
            sb.Append("              </tr>");
            sb.Append("              <tr>");
            sb.Append("                <td height=\"11\" colspan=\"3\">				</td>");
            sb.Append("                </tr>");
            #endregion

        }
        #endregion
        return sb;
    }

}
